#ifndef UTIL_RL_AGENT
#define UTIL_RL_AGENT

#define NDEBUG
#include <assert.h>


#include "stdlib.h"
#include "stdio.h"

#include "string.h"
#include "types.h"
#define USE_MATLAB		//if you comment this line, the matlab is not compiled with the code

#if defined(linux) || defined(__linux)
#undef OS_WINDOWS
#else
#define OS_WINDOWS
#endif

//#define	OS_WINDOWS



#define USE_THREADS
//#define MATLAB_PLOT


//don't touch the followng lines. we have to compile matlab code when plotting in matlab
#ifdef MATLAB_PLOT
	#define USE_MATLAB
#endif



#ifdef OS_WINDOWS
//#define _CRTDBG_MAP_ALLOC
//#define _CRTDBG_MAP_ALLOC_NEW
#include <stdlib.h>
#include <crtdbg.h>

#ifdef _DEBUG
      #define MYDEBUG_NEW   new( _NORMAL_BLOCK, __FILE__, __LINE__)
       // Replace _NORMAL_BLOCK with _CLIENT_BLOCK if you want the
       //allocations to be of _CLIENT_BLOCK type
#else
      #define MYDEBUG_NEW
#endif // _DEBUG
#endif


#ifndef	OS_WINDOWS
#include <sys/time.h>
#endif

#define	PI	3.141597

int intRand(int ub);
double floatRand(double ub);
double floatRand(double lb, double ub);
double abs_double(double d);
double mdistance(Observation o1, Observation o2);
bool fileExists(const char* ch);
void eliminateBYShuffle(bool* result, int n, int max);	//selects max items from total number of 'n' by random and returns them in a bool array

double deg2rad(double deg);
double rad2deg(double rad);


#ifdef OS_WINDOWS
#include <windows.h>
void usleep(long d);
#endif

#ifndef OS_WINDOWS
void measureTimeStart();
double measureTimeEnd();
#endif

#ifdef OS_WINDOWS
double drand48();
#endif



#endif
